package com.beney.controller;

import com.beney.client.Client;
import com.beney.codec.MessagePacket;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class TestController {

    private Logger logger = LoggerFactory.getLogger(getClass());

    @Autowired
    private Client client;

    @PostMapping("/mock")
    public String mock(String type, String message) {
        MessagePacket messagePacket = new MessagePacket(type, message);
        client.send(messagePacket);
        return "success";
    }
}
